package com.webSite.demo.cy.downBook;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import cn.hutool.core.io.file.FileReader;
import cn.hutool.core.io.file.FileWriter;

public class Dobook {

	public static void main(String[] args) {
//		FileReader reader = new FileReader("C:\\Users\\fengzihao\\Desktop\\缺失.txt");
		FileWriter writer = new FileWriter("C:\\Users\\fengzihao\\Desktop\\重构1.txt");
//		//需要
//		for(String bk:reader.readLines()) {
//			writer.append(getDocList(bk));
//		}
		
		String[] fileList = {"第三百三十七章萧然到来强来势镇压","第三百三十八章震惊的学员摘取八灵果","第三百三十九章冰轮丸卍解灭十妖兽","第三百四十章奇异的星四辰果实完成考核","第三百四十一章离开遇四陷入绝境的学员"};
		
		for(String bk:fileList) {
			writer.append(getDocList(bk));
		}
		
	}

	private static String getDocList(String bk) {
		String srcPath = "C:\\Users\\fengzihao\\Desktop\\天若批量文字识别\\识别内容";
		File file = new File(srcPath);
		List<File> fileArray = new ArrayList<File>();
		for(File f:file.listFiles()) {
			if(f.getName().contains(bk)) {
				fileArray.add(f);
			}
		}
		StringBuilder builder = new StringBuilder(bk+"\r\n");
		
		int size = fileArray.size();
		
		for(int j = 0; j<size; j++) {
			builder.append(ReadWord.readWord(srcPath+"\\"+bk+"("+Integer.valueOf(j+1)+").doc"));
		}
		return builder.append("\r\n").toString();
	}
}
